class RepliesController < ApplicationController
before_action :find_topic

	def create
		@reply= Reply.new(reply_params)
		@reply.topic_id=@topic.id
		@reply.user_id=current_user.id

		 @reply.save

		respond_to do |format|
			format.html{
			redirect_to topic_path(@topic)
			}
			format.js
		end


	end

	def index

	end

	def edit

	end

	def show

	end

	def update

	end

	def destroy

	end

	private

		def find_topic
			@topic=Topic.find(params[:topic_id])
		end

		def reply_params
			params.require(:reply).permit(:body)
		end

end
